<!-- 引入Bootstrap CSS -->
    <link href="{% static 'bootstrap/bootstrap.min.css' %}" rel="stylesheet">
    <!-- Bootstrap 图标 -->
    <!-- 引入bootstrap-icons -->
    <link rel="stylesheet" href="{% static 'bootstrap-icons-1.13.1/bootstrap-icons.css' %}">
    <link href="{% static 'bootstrap-icons-1.13.1/fonts/bootstrap-icons.woff' %}" rel="stylesheet">
    <link href="{% static 'bootstrap-icons-1.13.1/fonts/bootstrap-icons.woff2' %}" rel="stylesheet">

<div class="container mt-4">
    <h1><i class="bi bi-clock me-2"></i>{{ title }}</h1>

    <form method="post">
        {% csrf_token %}

        {% if form.non_field_errors %}
            <div class="alert alert-danger">
                {% for error in form.non_field_errors %}
                    {{ error }}
                {% endfor %}
            </div>
        {% endif %}

        <div class="mb-3">
            <label for="{{ form.name.id_for_label }}" class="form-label"><i class="bi bi-card-text me-2"></i>时间段名称</label>
            {{ form.name }}
            {% if form.name.errors %}
                <div class="text-danger">
                    {% for error in form.name.errors %}
                        {{ error }}
                    {% endfor %}
                </div>
            {% endif %}
        </div>

        <div class="mb-3">
            <label for="{{ form.start_time.id_for_label }}" class="form-label"><i class="bi bi-alarm me-2"></i>开始时间</label>
            {{ form.start_time }}
            {% if form.start_time.errors %}
                <div class="text-danger">
                    {% for error in form.start_time.errors %}
                        {{ error }}
                    {% endfor %}
                </div>
            {% endif %}
        </div>

        <div class="mb-3">
            <label for="{{ form.duration.id_for_label }}" class="form-label"><i class="bi bi-hourglass-split me-2"></i>课程时长(分钟)</label>
            {{ form.duration }}
            {% if form.duration.errors %}
                <div class="text-danger">
                    {% for error in form.duration.errors %}
                        {{ error }}
                    {% endfor %}
                </div>
            {% endif %}
        </div>

        <button type="submit" class="btn btn-primary"><i class="bi bi-save me-2"></i>保存</button>
        <a href="{% url 'core:course_period_list' %}" class="btn btn-secondary"><i class="bi bi-arrow-left me-2"></i>取消</a>
    </form>
</div>
